from handle_xmind.xmind import XMind
from handle_xmind.xmind_check import XMindCheck
from jira.test_case import TestCase
from jira.jira import Jira

if __name__ == '__main__':
    # 文件路径
    path = '/Users/hepengchong/Documents/Xmind/中心主题.xmind'
    # 校验XMind
    check_data = XMindCheck(path)
    # 解析XMind数据
    case_data = XMind(check_data.path).case_data
    # jira实现用例
    test_cases = TestCase(case_data.project_name, case_data.all_modules_name, case_data.zt_case).hangle_case()
    # 导入至jira
    code, _ = Jira().sync_zt_case(test_cases)
    if code == 200:
        print('一共有{}条用例，导入成功'.format(len(test_cases)))
    else:
        print('用例导入失败')
